package com.qingke.oo.InnerClass;

public class Car {
	private String brand = "";
	private String model = "";
	Battery battery;
	
	public Car(){
		
	}
	
	public Car(String brand,String model){
		this.brand = brand;
		this.model = model;
		Battery b = this.new Battery(); 
	}
	
	public class Battery {
		private int power = 1000;
		public int userPower() {
			if(power>=300){
				power-=100;
				return 1;
			}
			
			if(power>100&&power<300){
				power-=100;
				return 0;
			}
			
			return -1;
		}
		
		public void charge(){
			power = 1000;
		}
		
	} 
	
	public boolean start(){
		Car.Battery b = new Car.Battery();
		int i = b.userPower();
		if(i==-1){
			b.charge();
			return false;
		}
		
		return true;
	}
	
	public String getBrand() {
		return brand;
	}

	public void setBrand(String brand) {
		this.brand = brand;
	}

	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	public Battery getBattery() {
		return battery;
	}

	public void setBattery(Battery battery) {
		this.battery = battery;
	}	
	
}
